# -*- coding: utf-8 -*-

import redis

redis_db = redis.Redis(host='127.0.0.1', port=6379, db=0, password=None)
redis_baidu_res_key = 'baidu_res_url'
redis_baidu_req_key = 'baidu_req_url'

start_urls_pool = ['http://baike.baidu.com/view/' + str(pageId) + '.htm' for pageId in xrange(0, 15000000)]


def add_new_start_urls(redis_conn, url_list):
    for item in url_list:
        redis_conn.hsetnx(redis_baidu_req_key, item, 0)

    print "Add start_urls complete."


if __name__ == '__main__':
    add_new_start_urls(redis_db, start_urls_pool)
